

from rest_framework.response import Response

from rest_framework.response import Response


class APIResponse(Response):
    def __init__(self,code=200,msg='成功',result=None ,status=None, headers=None,content_type=None, **kwargs):
        dic= {'code': code, 'msg': msg}
        if result:
            dic['result'] = result
        dic.update(kwargs)  # key存在就修改，不存在则新增

        super().__init__(data=dic, status=status, headers=headers,content_type=content_type)


